export default {
    data() {
        return {
        }
    },
    computed: {
    },
    methods: {

        /**
         * 跳转页面
         * @param path
         * @param query
         * @param e
         */
        $navigateTo(path, query = {}, e) {
            let args = '';
            if (Object.keys(query).length) {
                args = '?';
                for (let i in query) {
                    if (query.hasOwnProperty(i)) {
                        args += i + '=' + query[i] + '&';
                    }
                }
                args = args.substring(0, args.length - 1);
            }
            uni.navigateTo({
                url: `${path + args}`,
                animationType: 'pop-in',
                animationDuration: 200
            });
            if (e) {
                e.stopPropagation();
            }
        },

        /**
         * 返回上一页，并重加载上一页
         */
        $navigateBackAndLoad () {
            let pages = getCurrentPages();
            let prevPage = pages[pages.length - 2];
            if (prevPage && prevPage.$vm.afterLoad) prevPage.$vm.afterLoad()
            uni.navigateBack()
        },

        /**
         * 返回上一页
         */
        $navigateBack() {
            uni.navigateBack();
        },
    }
}
